package com.guoxin.artconcurrency.chapter7;

import java.util.concurrent.atomic.AtomicIntegerArray;

/**
 * @author guoxin
 * @date 2019/8/6
 */
public class AtomicIntegerArrayTest {
    public static void main(String[] args) {
        int[] value = new int[]{1, 2, 3};
        AtomicIntegerArray arr = new AtomicIntegerArray(value);
        int i = arr.addAndGet(1, 10);
        System.out.println(i);
        int andSet = arr.getAndSet(0, 11);
        System.out.println(andSet);
    }
}
